<?php
/**
 * Campaign
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API for Sponsored Display
 *
 * This API enables programmatic access for campaign creation, management, and reporting for Sponsored Display campaigns. For more information on the functionality, see the [Sponsored Display Support Center](https://advertising.amazon.com/help#GTPPHE6RAWC2C4LZ). For API onboarding information, see the [account setup](https://advertising.amazon.com/API/docs/en-us/guides/onboarding/overview) topic.<br/><br/> > This specification is available for download from the **[Advertising API developer portal](https://d3a0d0y2hgofx6.cloudfront.net/openapi/en-us/sponsored-display/3-0/openapi.yaml).**
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * Campaign Class Doc Comment
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class Campaign extends BaseCampaign 
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'Campaign';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'campaign_id' => '\AmazonAdvertisingApi\Model\CampaignId',
        'tactic' => '\AmazonAdvertisingApi\Model\Tactic',
        'delivery_profile' => 'string',
        'rule_based_budget' => '\AmazonAdvertisingApi\Model\RuleBasedBudget'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'campaign_id' => null,
        'tactic' => null,
        'delivery_profile' => null,
        'rule_based_budget' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes + parent::AmazonAdvertisingApiTypes();
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats + parent::AmazonAdvertisingApiFormats();
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'campaign_id' => 'campaignId',
        'tactic' => 'tactic',
        'delivery_profile' => 'deliveryProfile',
        'rule_based_budget' => 'ruleBasedBudget'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'campaign_id' => 'setCampaignId',
        'tactic' => 'setTactic',
        'delivery_profile' => 'setDeliveryProfile',
        'rule_based_budget' => 'setRuleBasedBudget'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'campaign_id' => 'getCampaignId',
        'tactic' => 'getTactic',
        'delivery_profile' => 'getDeliveryProfile',
        'rule_based_budget' => 'getRuleBasedBudget'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return parent::attributeMap() + self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return parent::setters() + self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return parent::getters() + self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }

    const DELIVERY_PROFILE_AS_SOON_AS_POSSIBLE = 'as_soon_as_possible';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getDeliveryProfileAllowableValues()
    {
        return [
            self::DELIVERY_PROFILE_AS_SOON_AS_POSSIBLE,
        ];
    }


    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        parent::__construct($data);

        $this->container['campaign_id'] = isset($data['campaign_id']) ? $data['campaign_id'] : null;
        $this->container['tactic'] = isset($data['tactic']) ? $data['tactic'] : null;
        $this->container['delivery_profile'] = isset($data['delivery_profile']) ? $data['delivery_profile'] : null;
        $this->container['rule_based_budget'] = isset($data['rule_based_budget']) ? $data['rule_based_budget'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = parent::listInvalidProperties();

        $allowedValues = $this->getDeliveryProfileAllowableValues();
        if (!is_null($this->container['delivery_profile']) && !in_array($this->container['delivery_profile'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'delivery_profile', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets campaign_id
     *
     * @return \AmazonAdvertisingApi\Model\CampaignId
     */
    public function getCampaignId()
    {
        return $this->container['campaign_id'];
    }

    /**
     * Sets campaign_id
     *
     * @param \AmazonAdvertisingApi\Model\CampaignId $campaign_id campaign_id
     *
     * @return $this
     */
    public function setCampaignId($campaign_id)
    {
        $this->container['campaign_id'] = $campaign_id;

        return $this;
    }

    /**
     * Gets tactic
     *
     * @return \AmazonAdvertisingApi\Model\Tactic
     */
    public function getTactic()
    {
        return $this->container['tactic'];
    }

    /**
     * Sets tactic
     *
     * @param \AmazonAdvertisingApi\Model\Tactic $tactic tactic
     *
     * @return $this
     */
    public function setTactic($tactic)
    {
        $this->container['tactic'] = $tactic;

        return $this;
    }

    /**
     * Gets delivery_profile
     *
     * @return string
     */
    public function getDeliveryProfile()
    {
        return $this->container['delivery_profile'];
    }

    /**
     * Sets delivery_profile
     *
     * @param string $delivery_profile delivery_profile
     *
     * @return $this
     */
    public function setDeliveryProfile($delivery_profile)
    {
        $allowedValues = $this->getDeliveryProfileAllowableValues();
        if (!is_null($delivery_profile) && !in_array($delivery_profile, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'delivery_profile', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['delivery_profile'] = $delivery_profile;

        return $this;
    }

    /**
     * Gets rule_based_budget
     *
     * @return \AmazonAdvertisingApi\Model\RuleBasedBudget
     */
    public function getRuleBasedBudget()
    {
        return $this->container['rule_based_budget'];
    }

    /**
     * Sets rule_based_budget
     *
     * @param \AmazonAdvertisingApi\Model\RuleBasedBudget $rule_based_budget rule_based_budget
     *
     * @return $this
     */
    public function setRuleBasedBudget($rule_based_budget)
    {
        $this->container['rule_based_budget'] = $rule_based_budget;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
